/*
 *===========================================================================
 *
 *          Name: jk_demo.c
 *        Create: Sun 28 Oct 2012 12:58:34 PM CST
 *
 *   Discription: 
 *       Version: 1.0.0
 *
 *        Author: yuwei.zhang
 *         Email: yuwei.zhang@besovideo.com
 *
 *===========================================================================
 */

#include <stdio.h>

#include "jkprint.h"

//int level = JK_PRINT_INFO|JK_PRINT_ERROR|JK_PRINT_WARN;
int level = JK_PRINT_ALL &~JK_PRINT_DEBUG &~JK_PRINT_CYCLE;

int style = JK_PRINT_NOTIME;

int color = JK_COLOR_TRUE;

enum {
	JK_PRINT_KIND_TEST1 = 0x11,
	JK_PRINT_KIND_TEST2 = 0x16,
};


int main(int argc, char **args)
{
/*
    if (jk_print_init(level, style, color, (char*)"") < 0) {
        printf("Error: init jk error\n");
        return -1;
    }
*/
    jk_print_init(level, style, color, (char*)"test");
    JKERROR("[%s]\n", "error");
    JKERROR("[%s]\n", "testerror2");
    JKERROR("[%s]\n", "testerror3");
    JKINFO("[%s]\n", "info");
    int ll = JK_PRINT_ALL;
    JKINFO("print all\n");
    jk_print_change_level(ll);
    JKWARN("[%s]\n", "warn");
    JKNONE("[%s]\n", "none");
    JKDEBUG("[%s]\n", "debug");

    ll = JK_PRINT_NONE;
    JKINFO("print none\n");
    jk_print_change_level(ll);
    JKERROR("[%s][%s]\n", "error", "error2");
    JKINFO("[%s][%s]\n", "info", "error3");

    ll = JK_PRINT_ALL & ~JK_PRINT_DEBUG;
    jk_print_change_level(ll);
    JKSTDERROR("KKKKKKK");
    JKINFO("just print info, debug and all\n");
    JKPRINT(JK_PRINT_ERROR, "[%s]\n", "print error");
    JKPRINT(JK_PRINT_WARN, "[%s]\n", "print warn");
    JKPRINT(JK_PRINT_INFO, "[%s]\n", "print info");
    JKPRINT(JK_PRINT_DEBUG, "[%s]\n", "print debug");
    JKPRINT(JK_PRINT_NONE, "[%s]\n", "print none"); // never print

    JKPRINT(JK_PRINT_NONE, "\n");

    JKINFO("another test\n");
    JKKIND(JK_PRINT_KIND_TEST1, "you will not out\n");
    jk_print_add_kind(JK_PRINT_KIND_TEST2);
    JKKIND(JK_PRINT_KIND_TEST1, "youshoud out\n");
    JKKIND(JK_PRINT_KIND_TEST2, "test2 not out\n");
    jk_print_add_kind(JK_PRINT_KIND_TEST1);
    JKKIND(JK_PRINT_KIND_TEST2, "test2 out\n");
    jk_print_del_kind(JK_PRINT_KIND_TEST2);
    JKKIND(JK_PRINT_KIND_TEST1, "test1 not out\n");
    JKKIND(JK_PRINT_KIND_TEST2, "test2 out savme\n");
    JKINFO("OVER\n");

    JKDEBUG("test debug\n");
    JKCYCLE("CYCLE PRINT\n");
    jk_print_change_level(~JK_PRINT_CYCLE);
    JKCYCLE("cycle print no out\n");
    JKDEBUG("test debug over\n");

    jk_print_deinit();

    return 0;
}


/*=============== End of file: jk_demo.c ==========================*/

